<template>
	<view>
		<view class="apply-list">
			<Apply v-for="item in applyList" :key="item.id" :real_name="item.real_name"
				:apply_cause="item.apply_cause" :apply_date="item.apply_date" :apply_role="item.apply_role"
				:apply_type="item.apply_type" :no="item.id"  @refuse="refuse" @pass="pass"></Apply>
		</view>
	</view>
</template>

<script>
	import {
		getRoleApply
	} from '../../api/roleapply.js'
	import {
		updRoleApply
	} from '../../api/roleapply.js'
	import Apply from './components/apply.vue'
	export default {
		data() {
			return {
				applyList: []
			}
		},
		onLoad() {
			this.getRoleApply()
		},
		methods: {
			async getRoleApply() {
				const {
					data: res
				} = await getRoleApply()
				this.applyList = res.data.applyList
			},
			async refuse(obj){
				const { data: res } = await updRoleApply(obj)
				console.log(res)
				this.getRoleApply()
			},
			async pass(obj){
				const { data: res } = await updRoleApply(obj)
				console.log(res)
				this.getRoleApply()
			}
		},
		components: {
			Apply
		}
	}
</script>

<style lang="less">
	page {
		background-color: #F7F7F7;
	}

	.apply-list {
		margin-top: 30rpx;
	}
</style>
